unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls;

type
  TForm1 = class(TForm)
    Btn_1: TButton;
    procedure Btn_1Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;
  TParent=class(TObject)
  public
    Age:Integer;
    Name:string;
    Field:Integer;
  public
    procedure CalcMonth;
  public
    constructor Create(AAge,AField:Integer);overload;
    constructor Create(AAge:Integer);overload;
    constructor Create(AName:string);overload;
  end;

  {TChild=class(TParent)
  public
    constructor Create(AAge:Integer);
  end;}
var
  Form1: TForm1;

implementation

{$R *.dfm}

{ TChild }

{constructor TChild.Create(AAge: Integer);
begin
  //
end;   }

{ TParent }

constructor TParent.Create(AAge: Integer);
begin
  //
  Age:=AAge;
end;

procedure TForm1.Btn_1Click(Sender: TObject);
var
  Par:TParent;
//  BPar:TParent;
begin
{  Par:=TParent.Create(10);
  BPar:=TParent.Create('HEHE');
  ShowMessage(IntToStr(Par.Age));
  ShowMessage(BPar.Name);
  FreeAndNil(Par);
  FreeAndNil(BPar); }
  Par:=TParent.Create(10,1024);
  ShowMessage(Par.Name);
  FreeAndNil(Par);
end;

procedure TParent.CalcMonth;
begin
  Name:=IntToStr(Age * Field);
end;

constructor TParent.Create(AName: string);
begin
  Name:=AName;
end;

constructor TParent.Create(AAge, AField: Integer);
begin
  Age:=AAge;
  Field:=AField;
  CalcMonth;
end;

end.
